package io.zhengsh.juc._2synchronized1;

import org.openjdk.jol.info.ClassLayout;

public class SynchronizedMethodTest {

    public static void main(String[] args) {
        SynchronizedMethodTest methodTest = new SynchronizedMethodTest();
        System.out.println("获取锁 +++++++++");
        System.out.println(ClassLayout.parseInstance(methodTest).toPrintable());
        methodTest.test1();
        System.out.println("获取锁 ---------");
        System.out.println(ClassLayout.parseInstance(methodTest).toPrintable());
        test();
    }

    public synchronized static void test() {
        System.out.println(1);
    }

    public synchronized void test1() {
        System.out.println(1);
    }
}
